import request from '@/utils/request'
import { stringify } from 'qs'
/**
 * 角色管理列表
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleList() {
    return request({
      url: '/scrm-api/console/login-api/role/list',
      method: 'get'
    })
  }
  /**
 * 筛选的列表
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function screenRoleList() {
  return request({
    url: '/scrm-api/console/login-api/role/screen-list',
    method: 'get'
  })
}
  /**
 * 添加角色
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleAdd(data:any) {
    return request({
      url: '/scrm-api/console/login-api/role/add',
      method: 'post',
      data: data
    })
  }
/**
 * 编辑角色
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleEdit(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/edit/name',
    method: 'post',
    data: data
  })
}
/**
 * 商户菜单
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleTenant(data?:any) {
  return request({
    url: '/scrm-api/console/login-api/tenant/all-function',
    method: 'get',
    params: data
  })
}
/**
 * 已有的角色菜单列表
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleTenantExist(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/exist/function/list',
    method: 'get',
    params: data
  })
}
/**
 * 发送短信验证码
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function sendCode(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/send/sms/code',
    method: 'post',
    data: data
  })
}
/**
 * 验证短信验证码
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function verifyCode(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/verify/sms/code',
    method: 'post',
    data: data
  })
}
/**
 * 分配角色（子账号）
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function assignRole(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/assign',
    method: 'post',
    data: data
  })
}
/**
 * 批量分配角色（子账号）
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function batchAssignRole(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/batch/assign',
    method: 'post',
    data: data
  })
}
/**
 * 选中的角色菜单id
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function roleFunction(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/function/list',
    method: 'post',
    data: data
  })
}
 export function roleFunction2(data:any) {
  return request({
    url: '/scrm-api/console/login-api/tenant/all-function',
    method: 'get',
    params:data
  })
}
/**
 * 编辑权限
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
 export function permissionEdit(data:any) {
  return request({
    url: '/scrm-api/console/login-api/role/edit',
    method: 'post',
    data: data
  })
}
